package com.sysmanage.etl.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtils {
	public static final String PARENT_ONLYDATE = "yyyy-MM-dd";
	public static final String PARENT_ALL = "yyyy-MM-dd HH:mm:ss";
	public static final String PARENT_SIMPLE_ALL = "yyyyMMddHHmmss";

	public static String format(Date date, String paren) {
		SimpleDateFormat format = new SimpleDateFormat(paren);
		return format.format(date);
	}

	public static Date parse(String source, String paren) {
		SimpleDateFormat format = new SimpleDateFormat(paren);
		Date date = null;
		try {
			date = format.parse(source);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return date;
	}
}
